/**
 * 
 */
package com.hereway.core.service;

import java.io.Serializable;
import java.util.List;

import com.hereway.core.context.PageBean;
import com.hereway.core.exception.ServiceException;

/**
 * @author kevin
 *
 */
public interface IService<T,PK extends Serializable> {

	/**
	 * 根据PK查找对象
	 * 
	 * @auth kevin
	 * @param pk
	 * @return
	 * @throws ServiceException
	 */
	public T load(PK pk) throws ServiceException;
	
	public T get(PK pk) throws ServiceException;
	/**
	 * 得到所有记录
	 * @return
	 * @throws ServiceException
	 */
	public List<T> loadAll() throws ServiceException;
	
	public List<T> loadAll(PageBean page) throws ServiceException;

	/**
	 * 保存对象信息
	 * 
	 * @auth kevin
	 * @param t
	 * @throws ServiceException
	 */
	public void save(T entity) throws ServiceException;

	/**
	 * 更加PK删除对象信息
	 * 
	 * @auth kevin
	 * @param pk
	 * @throws ServiceException
	 */	
	public void delete(PK pk) throws ServiceException;

	public void delete(PK[] pks) throws ServiceException;
	
	public void delete(T entity) throws ServiceException;
	
	public void delete(List<T> list) throws ServiceException;
	
	/**
	 * 修改对象信息
	 * 
	 * @auth kevin
	 * @param T
	 * @throws ServiceException
	 */
	public void update(T entity) throws ServiceException;
}
